import request from '@/utils/request'
import type { OrgParams } from './model/organization'

// 获取组织机构树列表
export const getOrgTree = async (params?: any) => {
  return await request.get('/system/dept/deptTree', { params })
}

// 获取无人机巡视点-标定
export const getUavTree = async (params?: any) => {
  return await request.get('/LabelUav/loadPartTree', { params })
}

// 获取巡视结果分析-任务点
export const getJobUavTree = async (params?: any) => {
  return await request.get('/patrolJobUavResult/loadPatrolJobUavTree', {
    params
  })
}

// 获取首页-设备台账树
export const getDeviceTree = async (params?: any) => {
  return await request.get('/index/getDeviceTree', {
    params
  })
}

// 获取全部组织机构列表-无权限控制
export const getAllOrgTree = async (params?: { type: number }) => {
  return await request.get('/system/dept/gettAllDeptTree', { params })
}

// 新增组织机构
export const addOrg = async (data: OrgParams) => {
  return await request.post('/system/dept/add', { data })
}

// 修改组织机构
export const editOrg = async (data: OrgParams) => {
  return await request.post('/system/dept/edit', { data })
}

// 删除组织机构
export const deleteOrg = async (deptId: string) => {
  return await request.get(`/system/dept/del/${deptId}`)
}
